import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  // {
  //   path: '/',
  //   redirect: '/login'
  // },{
  //   path: '/home',
  //   meta: { title: '首页', keepAlive: true },
  //   component: () => import('@/views/home')
  // }

  {
    path: '/',
    meta: { title: "登录", keepAlive: true },
    component: () => import('@/views/login')
  },
  {
    path: '/layout',
    meta: { title: "头部导航栏",  },
    component: () => import('@/component/layout'),
    children: [
      {
        path: 'index',
        meta: { title: "首页",  },
        component: () => import('@/views/index')
      },
      {
        name:'视频列表',
        path: 'videolist',
        meta: ["内容管理",'视频列表'],
        component: () => import('@/views/videolist')
      },
      {
        name:'图片列表',
        path: 'imgslist',
        meta: ["内容管理",'图片列表'],
        component: () => import('@/views/imgslist')
      },
      {
        path: 'backlist',
        meta: ["内容管理",'回收站'],
        component: () => import('@/views/back')
      },
      {
        path: 'taglist',
        meta: ["内容管理",'标签列表'],
        component: () => import('@/views/taglist')
      },
      {
        path: 'classlist',
        meta:  ["内容管理",'分类列表'],
        component: () => import('@/views/classification')
      },
      {
        path: 'waterlist',
        meta: { title: "水印列表",  },
        component: () => import('@/views/waterlist')
      },
      {
        path: 'register',
        meta: { title: "注册审核",  },
        component: () => import('@/views/register')
      },
      {
        path: 'userlist',
        meta:  ["用户管理",'用户列表'],
        component: () => import('@/views/userlist')
      },
      {
        path: 'datalist',
        meta:  ["数据管理",'数据统计'],
        component: () => import('@/views/datalist')
      },
      {
        path: 'pointall',
        meta:  ["数据管理",'积分统计'],
        component: () => import('@/views/pointall')
      },
      {
        path: 'pointchange',
        meta:   ["数据管理",'积分变动记录'],
        component: () => import('@/views/pointchange')
      },
      {
        path: "Rotationsettings",
        meta:  ["系统管理",'轮播设置'],
        component: () => import('@/views/Rotationsettings')
      },
      {
        path: "Rolemanagement",
        meta:  ["系统管理",'角色管理'],
        component: () => import('@/views/Rolemanagement')
      },
      {
        path: "announcement",
        meta:  ["系统管理",'公告提示'],
        component: () => import('@/views/announcement')
      },
      {
        path: "newadd",
        meta: { title: "新增" },
        component: () => import('@/views/newadd')
      },
      {
        path: "Rotaionedit",
        meta: { title: "编辑" },
        component: () => import('@/views/Rotaionedit')
      },
      {
        path: 'settings',
        meta: { title: "系统设置", },
        component: () => import('@/views/settings')
      },
      {
        path: 'videoaudit',
        meta: { title: "案例审核", },
        component: () => import('@/views/videoaudit')
      },
      {
        path: 'operationLog',
        meta: { title: "操作日志", },
        component: () => import('@/views/operationLog')
      },
    ]
  },
]
const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
